package pers.hl.module_main.admin.user

import pers.hl.common.base.BaseViewModel
import pers.hl.common.base.SingleLiveEvent
import pers.hl.lib_global.http.LibResponse
import pers.hl.lib_global.model.bean.User

class UserManageViewModel: BaseViewModel<UserManageModel>() {

    fun deleteUser(userId: Int): SingleLiveEvent<String> {
        val event = SingleLiveEvent<String>()
        launchOnIO {
            val result = mModel.deleteUser(listOf(userId))
            event.postValue(result.msg)
        }
        return event
    }

    fun getAllUsers(): SingleLiveEvent<List<User>> {
        val event = SingleLiveEvent<List<User>>()
        launchOnIO {
            val result = mModel.getAllUsers()
            event.postValue(result.data)
        }
        return event
    }

}
